<style scoped>
.chart {
  height: 450px;
}
</style>


<template>
  <div>
    <z-line-chart :def="def"></z-line-chart>
    <vue-code-mirror :tpl="d.tpl" :js="d.js"></vue-code-mirror>
    <h3>基本setting参数</h3>
    <doc-props :data="doc.props"></doc-props>
  </div>
</template>

<script>
import ZLineChart from "@/zpkgs/components/z-chart/ZLineChart";
import ZBarChart from "@/zpkgs/components/z-chart/ZBarChart";
import VueCodeMirror from "@example/components/VueCodeMirror";
import DocProps from "@example/plugins/example/components/DocProps";

let o = {
  columns: ['星期', '直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎'],
  rows: [
    ['周一', 320, 302, 301, 334, 390, 330, 320],
    ['周二', 120, 132, 101, 134, 90, 230, 210],
    ['周三', 220, 182, 191, 234, 290, 330, 310],
    ['周四', 150, 212, 201, 154, 190, 330, 410],
    ['周五', 320, 132, 401, 334, 290, 330, 320]
  ]
}
o.records = o.rows

export default {
  components: {
    DocProps,
    VueCodeMirror,
    ZBarChart,
    ZLineChart,
  },
  provide: {
  },
  data() {
    return {
      def: o,
      option: {
        title: {
          text: "Traffic Sources",
          left: "center"
        },
        tooltip: {
          trigger: "item",
          formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
          orient: "vertical",
          left: "left",
          data: [
            "Direct",
            "Email",
            "Ad Networks",
            "Video Ads",
            "Search Engines"
          ]
        },
        series: [
          {
            name: "Traffic Sources",
            type: "pie",
            radius: "55%",
            center: ["50%", "60%"],
            data: [
              { value: 335, name: "Direct" },
              { value: 310, name: "Email" },
              { value: 234, name: "Ad Networks" },
              { value: 135, name: "Video Ads" },
              { value: 1548, name: "Search Engines" }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)"
              }
            }
          }
        ]
      },
      doc: {
        props: [
          {
            name: 'def',
            type: 'Object',
            defVal: '{columns: [], records: []}',
            desc: '定义'
          }
        ]
      },
      d: {
        tpl: `
    <z-line-chart :def="def"></z-line-chart>
        `,
        js: `
def = {
  columns: ['星期', '直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎'],
  records: [
    ['周一', 320, 302, 301, 334, 390, 330, 320],
    ['周二', 120, 132, 101, 134, 90, 230, 210],
    ['周三', 220, 182, 191, 234, 290, 330, 310],
    ['周四', 150, 212, 201, 154, 190, 330, 410],
    ['周五', 320, 132, 401, 334, 290, 330, 320]
  ]
}
        `
      }
    }
  },
  setup() {
    return {
    }
  }
}
</script>
